<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('货区设置列表')" />
</head>
<body class="gray-bg">
    
     <div class="container-div" onmousemove="parent.updateTimeOut()">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="formId">
					<div class="select-list">
						<ul>
							<li>
								<form class="form-horizontal m" id="form-areaInfo-add">
									<div class="form-group">
										<label class="col-sm-3 control-label">仓库：</label>
										<div class="col-sm-8">
											<select id="wareId" name="wareId" class="form-control" >
												<option v-for="ware in wares" v-bind:value="ware.wareId">{{ware.wareName}}</option>
											</select>
										</div>
									</div>
								</form>
							</li>



							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
								<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>
			</div>
			
	        <div class="btn-group-sm" id="toolbar" role="group">
				<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:areaInfo:add">
					<i class="fa fa-plus"></i> 添加
				</a>
<!--				<a class="btn btn-primary btn-edit disabled" onclick="$.operate.edit()" shiro:hasPermission="system:areaInfo:edit">-->
<!--					<i class="fa fa-edit"></i> 修改-->
<!--				</a>-->
				<a class="btn btn-danger btn-del btn-del disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:areaInfo:remove">
					<i class="fa fa-remove"></i> 删除
				</a>
				<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:areaInfo:export">
						<i class="fa fa-download"></i> 导出
				 </a>
			</div>
			<div class="col-sm-12 select-table table-striped">
				<table id="bootstrap-table" data-mobile-responsive="true"></table>
			</div>
		</div>
	</div>
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('system:areaInfo:edit')}]];
        var removeFlag = [[${@permission.hasPermi('system:areaInfo:remove')}]];
        var prefix = ctx + "system/areaInfo";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
				exportUrl: prefix + "/export",
                modalName: "货区设置",
		        showExport: true,
                columns: [{
		            checkbox: true
		        },
				{
					field : 'areaId', 
					title : '货区ID',
					visible: false
				},
				{
					field : 'areaCode', 
					title : '货区编码',
					sortable: true
				},
				{
					field : 'areaName', 
					title : '货区名',
					sortable: true
				},
				{
					field : 'createTime',
					title : '添加时间',
					sortable: true
				},
				{
					field : 'memo',
					title : '备注',
					sortable: true
				},
				{
					field : 'wareName',
					title : '仓库',
					sortable: true
				},

		        {
		            title: '操作',
		            align: 'center',
		            formatter: function(value, row, index) {
		            	var actions = [];
		            	actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.areaId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.areaId + '\')"><i class="fa fa-remove"></i>删除</a>');
						return actions.join('');
		            }
		        }]
            };
            $.table.init(options);
        });


		var app = new Vue({
			el: '.container-div',
			data: {
				message: 'Hello Vue!',
				wares:[],
			},
			methods:{


				getWares:function(){

					var that = this;
					$.ajax({
						cache : true,
						type : "POST",
						url :  "/system/wareInfo/list",
						data : {

						},
						async : false,
						error : function(request) {
							$.modal.alertError("系统错误");
						},
						success : function(data) {
							that.wares = data.rows;
						}
					});

				}
			},
			created:function(){
				this.getWares();

			},

		})
    </script>
</body>
</html>

















